package com.quanxiaoha.xiaohashu.note.biz.rpc;


import com.quanxiaoha.framework.common.response.Response;
import com.quanxiaoha.xiaohashu.user.api.UserFeignApi;
import com.quanxiaoha.xiaohashu.user.dto.req.FindUserByIdReqDTO;
import com.quanxiaoha.xiaohashu.user.dto.resp.FindUserByIdRspDTO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * @Author: jingyan_liu
 * @CreateTime: 2025-07-31
 * @Description:
 * @Version: 1.0
 */


@Component
public class UserRpcService {
	
	@Resource
	private UserFeignApi userFeignApi;
	
	/**
	 * 查询用户信息
	 *
	 * @param userId
	 * @return
	 */
	public FindUserByIdRspDTO findById(Long userId) {
		FindUserByIdReqDTO findUserByIdReqDTO = new FindUserByIdReqDTO();
		findUserByIdReqDTO.setId(userId);
		
		Response<FindUserByIdRspDTO> response = userFeignApi.findById(findUserByIdReqDTO);
		
		return response.isSuccess() ? response.getData() : null;
	}
	
}